<?php
declare(strict_types=1);
namespace Field;

class SysArticleContentConst
{
    public const pk='';
    public const index=['ArticleID'];
	public const fields=['ArticleID','FreeRoleID','Thumbs','Brief','Content'];
	public const comment=['ArticleID'=>'文章ID','FreeRoleID'=>'免费会员组,优先级高于分类','Thumbs'=>'轮播附件ID,1,2,3','Brief'=>'简介','Content'=>'文章内容'];
	/*
    * @Field ArticleID
    * @Type int(10) unsigned
    * @Collation 
    * @Null NO
    * @Key PRI
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 文章ID
    */
    public const ArticleID = 'ArticleID';
    /*
    * @Field FreeRoleID
    * @Type varchar(200)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 免费会员组,优先级高于分类
    */
    public const FreeRoleID = 'FreeRoleID';
    /*
    * @Field Thumbs
    * @Type varchar(600)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 轮播附件ID,1,2,3
    */
    public const Thumbs = 'Thumbs';
    /*
    * @Field Brief
    * @Type varchar(240)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 简介
    */
    public const Brief = 'Brief';
    /*
    * @Field Content
    * @Type text
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 文章内容
    */
    public const Content = 'Content';
}

class SysArticleContentColumns
{
public  int $ArticleID;
   public  ?string $FreeRoleID='';
   public  ?string $Thumbs='';
   public  ?string $Brief='';
   public  ?string $Content='';
	public function toArray():array
	{
		return [
'ArticleID'=>$this->ArticleID,
    'FreeRoleID'=>$this->FreeRoleID,
    'Thumbs'=>$this->Thumbs,
    'Brief'=>$this->Brief,
    'Content'=>$this->Content,        ];
	}
}

class SysArticleContentRow
{
	public SysArticleContentColumns $data;
	public function toArray():array
	{
		return $this->data->toArray();
    }

    public function getValue(string $field):string|int|null
    {
        return match ($field){
        'ArticleID' => $this->data->ArticleID,
        'FreeRoleID' => $this->data->FreeRoleID,
        'Thumbs' => $this->data->Thumbs,
        'Brief' => $this->data->Brief,
        'Content' => $this->data->Content, default=>null
        };
    }

    public function __construct(array $data)
    {
        $this->data = new SysArticleContentColumns();
        isset($data['ArticleID']) && $this->data->ArticleID = (int)$data['ArticleID'];
           isset($data['FreeRoleID']) && $this->data->FreeRoleID = (string)$data['FreeRoleID'];
           isset($data['Thumbs']) && $this->data->Thumbs = (string)$data['Thumbs'];
           isset($data['Brief']) && $this->data->Brief = (string)$data['Brief'];
           isset($data['Content']) && $this->data->Content = (string)$data['Content'];
    }
}
?>